package com.financial.service.heemoney.dto.param;

import com.financial.service.heemoney.dto.commmon.BaseHeemoneyCommonDTO;
import com.financial.service.heemoney.dto.businsess.BaseHeemoneyBusinessDTO;
import com.financial.service.heemoney.utils.JsonUtils;
import com.financial.service.heemoney.utils.MD5Utils;

import java.io.Serializable;

/**
 * @Author: wenguoqiang
 * @Email wguoqiango@163.com
 * @Date: 2019/12/2 0002 下午 4:34
 * @Des 汇收银公总参数基类
 */
public abstract class BaseHeemoneyParamDTO<T extends BaseHeemoneyCommonDTO, V extends BaseHeemoneyBusinessDTO> implements Serializable {

    public BaseHeemoneyParamDTO(T t , V v){

    }

    protected abstract String getSignStr();



    public String getSign() {
        T t = getCommonDTO();
        t.setBiz_content(JsonUtils.objectToJson(getBusinessDTO()));
        System.out.println(getSignStr());
        return MD5Utils.MD5en(getSignStr()).toUpperCase();
    }

    protected abstract V getBusinessDTO();

    protected abstract T getCommonDTO();

    public String getJsonParam() {
        T t = getCommonDTO();
        t.setSign(getSign());
        String reuslt = JsonUtils.objectToJson(t);
        return reuslt;
    }

}
